package com.pig4cloud.pigx.strategy.bo.okx;

import com.pig4cloud.pigx.strategy.bo.StrategyTaskContractCacheBO;
import com.pig4cloud.pigx.strategy.dto.StrategySyncOrderMsgDTO;
import com.pig4cloud.pigx.strategy.dto.StrategySyncStopOrderMsgDTO;
import com.pig4cloud.pigx.strategy.entity.StrategyContract;
import com.pig4cloud.pigx.strategy.entity.StrategyGroupContract;
import com.pig4cloud.pigx.strategy.entity.StrategyOrderContract;
import com.pig4cloud.pigx.strategy.entity.StrategyPositionContract;
import com.pig4cloud.pigx.strategy.entity.StrategySwitchContract;
import com.pig4cloud.pigx.strategy.entity.StrategyTaskContract;
import com.pig4cloud.pigx.system.entity.SystemLog;
import com.pig4cloud.pigx.system.entity.SystemProduct;
import com.pig4cloud.pigx.user.dto.TransactionThenDTO;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * 同步订单信息BO
 *
 * @since 2022/11/29 17:16
 */
@Data
public class SyncOrderBO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * mq消息
     */
    private StrategySyncOrderMsgDTO<PlaceOrderBO> msg;

    /**
     * 订单id
     */
    private Long orderId;

    /**
     * 第三方订单id
     */
    private Long externalOrderId;

    /**
     * 订单
     */
    private StrategyOrderContract order;

    /**
     * 任务
     */
    private StrategyTaskContractCacheBO taskCache;

    /**
     * 策略
     */
    private StrategyContract strategy;

    /**
     * 策略组
     */
    private StrategyGroupContract group;

    /**
     * 产品
     */
    private SystemProduct product;

    /**
     * 是否是做多
     */
    private Boolean isLong = true;

    /**
     * 是否是平仓
     */
    private Boolean isClose = true;

    /**
     * 开关
     */
    private StrategySwitchContract switchContract;

    /**
     * 任务
     */
    private StrategyTaskContract task;

    /**
     * 仓位集合
     */
    private List<StrategyPositionContract> positionList;

    /**
     * 利润结算
     */
    private BigDecimal profitSettlement = BigDecimal.ZERO;

    /**
     * 订单是否完成
     */
    private boolean isOrderComplete = false;

    /**
     * 任务是否完成
     */
    private boolean isTaskComplete = false;

    /**
     * 任务是否异常
     */
    private boolean isTaskError = false;

    /**
     * 任务是否正常完成
     */
    private boolean isTaskNormalComplete = false;

    /**
     * 分红制度消息
     */
    private List<TransactionThenDTO> dividendsMsgList = new ArrayList<>(2);

    /**
     * 同步止盈止损消息
     */
    private List<StrategySyncStopOrderMsgDTO> syncStopOrderMsgList = new ArrayList<>();

    /**
     * 是否因燃油费不足暂停了策略
     */
    private boolean hasPauseWhenLowFuel = false;

    /**
     * 系统日志邮件
     */
    private List<SystemLog> systemLogList = new ArrayList<>(1);
}
